package cn.lookup.service;

import cn.lookup.mapper.UserMapper;
import cn.lookup.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {
    @Autowired(required = false)
    private UserMapper userMapper;
    @Transactional
    public User queryUserById(int id){
        User user = userMapper.selectByPrimaryKey(id);
        return user;
    }
    @Transactional
    public void addUser(User user){
        userMapper.insertSelective(user);
        int i =1/0;
    }
}
